package kuzha.runtime.jadapter;

import java.util.Iterator;

import kuzha.KuzhaObject;
import kuzha.runtime.Converter;

public class FromIteratorAdapter implements Iterator<KuzhaObject>, FromJavaObjectAdapter {
	private final Iterator<?> iter;
	
	public FromIteratorAdapter(Iterator<?> iter) {
		this.iter = iter;
	}
	
	@Override
	public boolean hasNext() {
		return iter.hasNext();
	}
	
	@Override
	public KuzhaObject next() {
		return Converter.toKuzhaObject(iter.next());
	}
	
	@Override
	public void remove() {
		iter.remove();
	}
	
	@Override
	public Object toJavaObject() {
		return iter;
	}
}
